#! /usr/bin/env python

import os
import pygame
from pygame.locals import *

'''
This py file is created to easily create backgrounds from sprites.
There are two options currently:
1) Use a single image as a background wallpaper
2) Use a single small image that is tiled to create a background wallpaper
'''

class BG (pygame.sprite.Sprite):
    def __init__(self, name, x, y, tiled):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.image.load (os.path.join('data/images', name)).convert()
        self.x = x
        self.y = y
        if tiled == True:
            self.image = pygame.transform.scale (self.image, (80,80))
        else:
            self.image = pygame.transform.scale (self.image, (1280,1024))
        self.rect = self.image.get_rect ()
        self.rect.topleft = (self.x, self.y)

    def Show (self, surface):
        surface.blit (self.image, self.rect)
